from application.enumeration.ContentTypeEnum import ContentTypeEnum
from application.enumeration.StatisticsTypeEnum import StatisticsTypeEnum
from application.model import TortoiseBaseModel
from tortoise.fields import BigIntField, CharEnumField


class StatisticsModel(TortoiseBaseModel):
    """
    各类文章统计表
    """
    target_id: int = BigIntField(null=False, unique=True, description="目标ID，唯一")
    quantity: int = BigIntField(default=0, description="当前数量，默认0")
    name: str = CharEnumField(enum_type=StatisticsTypeEnum, max_length=5, null=True,
                              description="统计名称枚举，喜欢，转发，评论，分享，浏览")
    content_type: str = CharEnumField(enum_type=ContentTypeEnum, max_length=5, null=True,
                                      description="统计的内容类型，帖子等等")

    class Meta:
        table: str = "statistics"  # 表名
        table_description: str = "各类文章统计表"  # 表描述
